﻿
namespace NetROS.Tiers.Windows.Forms
{
	/// <summary>
	/// abstract Knjizenje typed datagridview
	/// </summary>
	[System.ComponentModel.DesignerCategoryAttribute("code")]
	public abstract class KnjizenjeDataGridViewBase : System.Windows.Forms.UserControl
	{	
		/// <summary> 
		/// Thrown when the current Entity changed.
		/// </summary>
		public event System.EventHandler<KnjizenjeDataGridViewEventArgs> CurrentEntityChanged;
		
		#region Fields
				
		/// <summary> 
		/// the current entity.
		/// </summary>
		private Entities.Knjizenje _currentKnjizenje = null;
		//private Dictionary<string, string> _columnsHeaders = new Dictionary<string, string>();
		
		/// <summary> 
		/// the datagridview instance
		/// </summary>
		protected System.Windows.Forms.DataGridView uxKnjizenjeDataGridView;
		
		/// <summary> 
		/// the errorprovider
		/// </summary>
		protected System.Windows.Forms.ErrorProvider uxKnjizenjeErrorProvider;
		
		/// <summary> 
		/// the bindingsource
		/// </summary>
		protected System.Windows.Forms.BindingSource uxKnjizenjeBindingSource;
		
		
		/// <summary> 
		/// the DGV column associated with the ID property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxIDDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the Datum property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxDatumDataGridViewColumn;
		/// <summary> 
		/// the DGV column associated with the IDUserCreated property
		/// </summary>
		protected System.Windows.Forms.DataGridViewComboBoxColumn uxIDUserCreatedDataGridViewColumn;
		/// <summary> 
		/// the DGV column associated with the IDUserModified property
		/// </summary>
		protected System.Windows.Forms.DataGridViewComboBoxColumn uxIDUserModifiedDataGridViewColumn;
		/// <summary> 
		/// the DGV column associated with the IDUser property
		/// </summary>
		protected System.Windows.Forms.DataGridViewComboBoxColumn uxIDUserDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the DatumCreated property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxDatumCreatedDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the DatumModified property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxDatumModifiedDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the IDStatus property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxIDStatusDataGridViewColumn;
		
		#endregion
					
		#region Combo list
		
				
		private Entities.TList<Entities.Djelatnik> _IDUserCreatedList;
		
		/// <summary> 
		/// The list of selectable Djelatnik
		/// </summary>
		[System.ComponentModel.Category("DropDownList BindingSources")]
		public Entities.TList<Entities.Djelatnik> IDUserCreatedList
		{
			get {return this._IDUserCreatedList;}
			set 
			{
				this._IDUserCreatedList = value;
				this.uxIDUserCreatedDataGridViewColumn.DataSource = null;
				this.uxIDUserCreatedDataGridViewColumn.DataSource = this._IDUserCreatedList;
			}
		}
		
		private bool _allowNewItemInIDUserCreatedList;
		
		/// <summary> 
		/// Indicates if user can add an item in the list of Djelatnik
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInIDUserCreatedList
		{
			get { return _allowNewItemInIDUserCreatedList;}
			set
			{
				this._allowNewItemInIDUserCreatedList = value;
				this.uxIDUserCreatedDataGridViewColumn.DisplayStyle = value ? System.Windows.Forms.DataGridViewComboBoxDisplayStyle.ComboBox : System.Windows.Forms.DataGridViewComboBoxDisplayStyle.DropDownButton;
			}
		}
		
				
		private Entities.TList<Entities.Djelatnik> _IDUserModifiedList;
		
		/// <summary> 
		/// The list of selectable Djelatnik
		/// </summary>
		[System.ComponentModel.Category("DropDownList BindingSources")]
		public Entities.TList<Entities.Djelatnik> IDUserModifiedList
		{
			get {return this._IDUserModifiedList;}
			set 
			{
				this._IDUserModifiedList = value;
				this.uxIDUserModifiedDataGridViewColumn.DataSource = null;
				this.uxIDUserModifiedDataGridViewColumn.DataSource = this._IDUserModifiedList;
			}
		}
		
		private bool _allowNewItemInIDUserModifiedList;
		
		/// <summary> 
		/// Indicates if user can add an item in the list of Djelatnik
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInIDUserModifiedList
		{
			get { return _allowNewItemInIDUserModifiedList;}
			set
			{
				this._allowNewItemInIDUserModifiedList = value;
				this.uxIDUserModifiedDataGridViewColumn.DisplayStyle = value ? System.Windows.Forms.DataGridViewComboBoxDisplayStyle.ComboBox : System.Windows.Forms.DataGridViewComboBoxDisplayStyle.DropDownButton;
			}
		}
		
				
		private Entities.TList<Entities.Djelatnik> _IDUserList;
		
		/// <summary> 
		/// The list of selectable Djelatnik
		/// </summary>
		[System.ComponentModel.Category("DropDownList BindingSources")]
		public Entities.TList<Entities.Djelatnik> IDUserList
		{
			get {return this._IDUserList;}
			set 
			{
				this._IDUserList = value;
				this.uxIDUserDataGridViewColumn.DataSource = null;
				this.uxIDUserDataGridViewColumn.DataSource = this._IDUserList;
			}
		}
		
		private bool _allowNewItemInIDUserList;
		
		/// <summary> 
		/// Indicates if user can add an item in the list of Djelatnik
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInIDUserList
		{
			get { return _allowNewItemInIDUserList;}
			set
			{
				this._allowNewItemInIDUserList = value;
				this.uxIDUserDataGridViewColumn.DisplayStyle = value ? System.Windows.Forms.DataGridViewComboBoxDisplayStyle.ComboBox : System.Windows.Forms.DataGridViewComboBoxDisplayStyle.DropDownButton;
			}
		}
		
		#endregion
		
		#region Main Datasource
		
		private Entities.TList<Entities.Knjizenje> _KnjizenjeList;
				
		/// <summary> 
		/// The list of Knjizenje to be displayed in the DGV.
		/// </summary>
		[System.ComponentModel.Category("Data")]
		public Entities.TList<Entities.Knjizenje> KnjizenjeList
		{
			get {return this._KnjizenjeList;}
			set
			{
				this._KnjizenjeList = value;
				this.uxKnjizenjeBindingSource.DataSource = null;
				this.uxKnjizenjeBindingSource.DataSource = value;
				this.uxKnjizenjeDataGridView.DataSource = null;
				this.uxKnjizenjeDataGridView.DataSource = this.uxKnjizenjeBindingSource;				
				//this.uxKnjizenjeBindingSource.ListChanged += new System.ComponentModel.ListChangedEventHandler(uxKnjizenjeBindingSource_ListChanged);
				this.uxKnjizenjeBindingSource.CurrentItemChanged += new System.EventHandler(OnKnjizenjeBindingSourceCurrentItemChanged);
			}
		}
		
		private void OnKnjizenjeBindingSourceCurrentItemChanged(object sender, System.EventArgs e)
		{
			_currentKnjizenje = uxKnjizenjeBindingSource.Current as Entities.Knjizenje;
			
			if (_currentKnjizenje != null)
			{
				_currentKnjizenje.Validate();
			}
			//_Knjizenje.Validate();
			OnCurrentEntityChanged();
		}

		//void uxKnjizenjeBindingSource_ListChanged(object sender, System.ComponentModel.ListChangedEventArgs e)
		//{
			//throw new Exception("The method or operation is not implemented.");
		//}		
		
		#endregion
		
		/// <summary>
		/// Gets the currently selected <c cref="Entities.Knjizenje"/> instance.
		/// </summary>
		public Entities.Knjizenje SelectedKnjizenje
		{
			get {return this._currentKnjizenje;}
		}
		
		#region other properties
		
		/// <summary>
		/// Gets or sets a value indicating whether you have provided your own data-management operations for the DataGridView control.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public bool VirtualMode
		{
			get {return this.uxKnjizenjeDataGridView.VirtualMode;}
			set
			{
				this.uxKnjizenjeDataGridView.VirtualMode = value;
			}
		}
		
		/// <summary>
		/// Gets or sets a value indicating whether the option to add rows is displayed to the user.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public bool AllowUserToAddRows
		{
			get {return this.uxKnjizenjeDataGridView.AllowUserToAddRows;}
			set {this.uxKnjizenjeDataGridView.AllowUserToAddRows = value;}
		}
		
		/// <summary>
		/// Gets or sets a value indicating whether the user is allowed to delete rows from the DataGridView.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public bool AllowUserToDeleteRows
		{
			get {return this.uxKnjizenjeDataGridView.AllowUserToDeleteRows;}
			set {this.uxKnjizenjeDataGridView.AllowUserToDeleteRows = value;}
		}
		
		/// <summary>
		/// Gets the <c cref="DataGridView"/> instance.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public System.Windows.Forms.DataGridView DataGridView
		{
			get {return this.uxKnjizenjeDataGridView;}
		}
		
		/// <summary>
		/// Gets a collection that contains all the columns in the control.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]		
		[System.ComponentModel.DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Visible)]
		//[System.ComponentModel.EditorAttribute("System.Windows.Forms.Design.DataGridViewColumnCollectionEditor, System.Design", typeof(System.Drawing.Design.UITypeEditor))] 
		public System.Windows.Forms.DataGridViewColumnCollection Columns
		{
			get { return this.uxKnjizenjeDataGridView.Columns; }
		}
		
		#endregion
		
		/// <summary> 
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.IContainer components = null;
	
		/// <summary> 
		/// Clean up any resources being used.
		/// </summary>
		/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
		protected override void Dispose(bool disposing)
		{
			if (disposing && (components != null))
			{
				components.Dispose();
			}
			base.Dispose(disposing);
		}
	
		#region Constructor
	
		/// <summary>
		/// Initializes a new instance of the <see cref="KnjizenjeDataGridViewBase"/> class.
		/// </summary>
		public KnjizenjeDataGridViewBase()
		{			
			this.components = new System.ComponentModel.Container();			
			
			this.uxKnjizenjeDataGridView = new System.Windows.Forms.DataGridView();
			this.uxKnjizenjeBindingSource = new System.Windows.Forms.BindingSource(this.components);
			this.uxKnjizenjeErrorProvider = new System.Windows.Forms.ErrorProvider(this.components);
			this.uxIDDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxDatumDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxIDUserCreatedDataGridViewColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
			this.uxIDUserModifiedDataGridViewColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
			this.uxIDUserDataGridViewColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
			this.uxDatumCreatedDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxDatumModifiedDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxIDStatusDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			//this.uxIDUserCreatedBindingSource = new DjelatnikBindingSource(this.components);
			//((System.ComponentModel.ISupportInitialize)(this.uxIDUserCreatedBindingSource)).BeginInit();
			//this.uxIDUserModifiedBindingSource = new DjelatnikBindingSource(this.components);
			//((System.ComponentModel.ISupportInitialize)(this.uxIDUserModifiedBindingSource)).BeginInit();
			//this.uxIDUserBindingSource = new DjelatnikBindingSource(this.components);
			//((System.ComponentModel.ISupportInitialize)(this.uxIDUserBindingSource)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxKnjizenjeDataGridView)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxKnjizenjeBindingSource)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxKnjizenjeErrorProvider)).BeginInit();
			this.SuspendLayout();
						
			// 
			// uxKnjizenjeErrorProvider
			// 
			this.uxKnjizenjeErrorProvider.ContainerControl = this;
			this.uxKnjizenjeErrorProvider.DataSource = this.uxKnjizenjeBindingSource;						
			// 
			// uxKnjizenjeDataGridView
			// 
			this.uxKnjizenjeDataGridView.AutoGenerateColumns = false;
			this.uxKnjizenjeDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
			this.uxKnjizenjeDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
		this.uxIDDataGridViewColumn,
		this.uxDatumDataGridViewColumn,
		this.uxIDUserCreatedDataGridViewColumn,
		this.uxIDUserModifiedDataGridViewColumn,
		this.uxIDUserDataGridViewColumn,
		this.uxDatumCreatedDataGridViewColumn,
		this.uxDatumModifiedDataGridViewColumn,
		this.uxIDStatusDataGridViewColumn			});
			this.uxKnjizenjeDataGridView.Dock = System.Windows.Forms.DockStyle.Fill;
			this.uxKnjizenjeDataGridView.Location = new System.Drawing.Point(0, 0);
			this.uxKnjizenjeDataGridView.Name = "uxKnjizenjeDataGridView";
			this.uxKnjizenjeDataGridView.Size = new System.Drawing.Size(470, 300);
			this.uxKnjizenjeDataGridView.TabIndex = 0;	
			this.uxKnjizenjeDataGridView.BackgroundColor = System.Drawing.Color.WhiteSmoke;
			this.uxKnjizenjeDataGridView.EnableHeadersVisualStyles = false;
			this.uxKnjizenjeDataGridView.DataError += new System.Windows.Forms.DataGridViewDataErrorEventHandler(this.OnKnjizenjeDataGridViewDataError);
			this.uxKnjizenjeDataGridView.CellValueNeeded += new System.Windows.Forms.DataGridViewCellValueEventHandler(this.OnKnjizenjeDataGridViewCellValueNeeded);
			this.uxKnjizenjeDataGridView.CellValuePushed += new System.Windows.Forms.DataGridViewCellValueEventHandler(this.OnKnjizenjeDataGridViewCellValuePushed);
			
			//
			// uxIDDataGridViewColumn
			//
			this.uxIDDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDDataGridViewColumn.DataPropertyName = "ID";
			this.uxIDDataGridViewColumn.HeaderText = "ID";
			this.uxIDDataGridViewColumn.Name = "uxIDDataGridViewColumn";
			this.uxIDDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDDataGridViewColumn.ReadOnly = true;		
			//
			// uxDatumDataGridViewColumn
			//
			this.uxDatumDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxDatumDataGridViewColumn.DataPropertyName = "Datum";
			this.uxDatumDataGridViewColumn.HeaderText = "Datum";
			this.uxDatumDataGridViewColumn.Name = "uxDatumDataGridViewColumn";
			this.uxDatumDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxDatumDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxDatumDataGridViewColumn.ReadOnly = false;		
			//
			// uxIDUserCreatedDataGridViewColumn
			//
			this.uxIDUserCreatedDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDUserCreatedDataGridViewColumn.DataPropertyName = "IDUserCreated";
			this.uxIDUserCreatedDataGridViewColumn.HeaderText = "IDUserCreated";
			this.uxIDUserCreatedDataGridViewColumn.Name = "uxIDUserCreatedDataGridViewColumn";
			this.uxIDUserCreatedDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDUserCreatedDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDUserCreatedDataGridViewColumn.ReadOnly = false;		
			//
			// uxIDUserModifiedDataGridViewColumn
			//
			this.uxIDUserModifiedDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDUserModifiedDataGridViewColumn.DataPropertyName = "IDUserModified";
			this.uxIDUserModifiedDataGridViewColumn.HeaderText = "IDUserModified";
			this.uxIDUserModifiedDataGridViewColumn.Name = "uxIDUserModifiedDataGridViewColumn";
			this.uxIDUserModifiedDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDUserModifiedDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDUserModifiedDataGridViewColumn.ReadOnly = false;		
			//
			// uxIDUserDataGridViewColumn
			//
			this.uxIDUserDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDUserDataGridViewColumn.DataPropertyName = "IDUser";
			this.uxIDUserDataGridViewColumn.HeaderText = "IDUser";
			this.uxIDUserDataGridViewColumn.Name = "uxIDUserDataGridViewColumn";
			this.uxIDUserDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDUserDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDUserDataGridViewColumn.ReadOnly = false;		
			//
			// uxDatumCreatedDataGridViewColumn
			//
			this.uxDatumCreatedDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxDatumCreatedDataGridViewColumn.DataPropertyName = "DatumCreated";
			this.uxDatumCreatedDataGridViewColumn.HeaderText = "DatumCreated";
			this.uxDatumCreatedDataGridViewColumn.Name = "uxDatumCreatedDataGridViewColumn";
			this.uxDatumCreatedDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxDatumCreatedDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxDatumCreatedDataGridViewColumn.ReadOnly = false;		
			//
			// uxDatumModifiedDataGridViewColumn
			//
			this.uxDatumModifiedDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxDatumModifiedDataGridViewColumn.DataPropertyName = "DatumModified";
			this.uxDatumModifiedDataGridViewColumn.HeaderText = "DatumModified";
			this.uxDatumModifiedDataGridViewColumn.Name = "uxDatumModifiedDataGridViewColumn";
			this.uxDatumModifiedDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxDatumModifiedDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxDatumModifiedDataGridViewColumn.ReadOnly = false;		
			//
			// uxIDStatusDataGridViewColumn
			//
			this.uxIDStatusDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDStatusDataGridViewColumn.DataPropertyName = "IDStatus";
			this.uxIDStatusDataGridViewColumn.HeaderText = "IDStatus";
			this.uxIDStatusDataGridViewColumn.Name = "uxIDStatusDataGridViewColumn";
			this.uxIDStatusDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDStatusDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDStatusDataGridViewColumn.ReadOnly = false;		
			//
			// uxIDUserCreatedDataGridViewColumn
			//				
			this.uxIDUserCreatedDataGridViewColumn.DisplayMember = "Naziv";	
			this.uxIDUserCreatedDataGridViewColumn.ValueMember = "ID";	
			this.uxIDUserCreatedDataGridViewColumn.DisplayStyleForCurrentCellOnly = true;
			//uxIDUserCreatedDataGridViewColumn.DataSource = uxIDUserCreatedBindingSource;				
				
			//
			// uxIDUserModifiedDataGridViewColumn
			//				
			this.uxIDUserModifiedDataGridViewColumn.DisplayMember = "Naziv";	
			this.uxIDUserModifiedDataGridViewColumn.ValueMember = "ID";	
			this.uxIDUserModifiedDataGridViewColumn.DisplayStyleForCurrentCellOnly = true;
			//uxIDUserModifiedDataGridViewColumn.DataSource = uxIDUserModifiedBindingSource;				
				
			//
			// uxIDUserDataGridViewColumn
			//				
			this.uxIDUserDataGridViewColumn.DisplayMember = "Naziv";	
			this.uxIDUserDataGridViewColumn.ValueMember = "ID";	
			this.uxIDUserDataGridViewColumn.DisplayStyleForCurrentCellOnly = true;
			//uxIDUserDataGridViewColumn.DataSource = uxIDUserBindingSource;				
				
			
			// this
			this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
			this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
			this.Controls.Add(this.uxKnjizenjeDataGridView);
			this.Name = "KnjizenjeDataGridView";
			this.Size = new System.Drawing.Size(470, 300);
			//((System.ComponentModel.ISupportInitialize)(this.uxIDUserCreatedBindingSource)).EndInit();
			//((System.ComponentModel.ISupportInitialize)(this.uxIDUserModifiedBindingSource)).EndInit();
			//((System.ComponentModel.ISupportInitialize)(this.uxIDUserBindingSource)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxKnjizenjeErrorProvider)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxKnjizenjeDataGridView)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxKnjizenjeBindingSource)).EndInit();
			this.ResumeLayout(false);
		}
		#endregion
				
		#region events
		
		/// <summary>
		/// Raised the CurrentEntityChanged event.
		/// </summary>
		protected void OnCurrentEntityChanged()
		{
			if (CurrentEntityChanged != null)
			{
				KnjizenjeDataGridViewEventArgs args = new KnjizenjeDataGridViewEventArgs();
				args.Knjizenje = _currentKnjizenje;
				CurrentEntityChanged(this, args); 
			}
		}
		
		#endregion
		
		/// <summary>
		/// Strongly typed event 
		/// </summary>
		public class KnjizenjeDataGridViewEventArgs : System.EventArgs
		{
			private Entities.Knjizenje	_Knjizenje;
	
			/// <summary>
			/// the  Entities.Knjizenje instance.
			/// </summary>
			public Entities.Knjizenje Knjizenje
			{
				get { return _Knjizenje; }
				set { _Knjizenje = value; }
			}	
		}
		
		/// <summary>
		/// Handles the DataError event of the uxKnjizenjeDataGridView control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="T:System.Windows.Forms.DataGridViewDataErrorEventArgs"/> instance containing the event data.</param>
		protected void OnKnjizenjeDataGridViewDataError(object sender, System.Windows.Forms.DataGridViewDataErrorEventArgs e)
		{
			System.Diagnostics.Debug.WriteLine(string.Format( "{0}, {1}", e.ColumnIndex, e.RowIndex));
		}
		
		/// <summary>
		/// Handles the CellValueNeeded event of the uxKnjizenjeDataGridView control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="T:System.Windows.Forms.DataGridViewCellValueEventArgs"/> instance containing the event data.</param>
		protected void OnKnjizenjeDataGridViewCellValueNeeded(object sender, System.Windows.Forms.DataGridViewCellValueEventArgs e)
		{
			switch(uxKnjizenjeDataGridView.Columns[e.ColumnIndex].Name)
			{
					case "uxIDDataGridViewColumn":
						e.Value = KnjizenjeList[e.RowIndex].ID;
						break;
					case "uxDatumDataGridViewColumn":
						e.Value = KnjizenjeList[e.RowIndex].Datum;
						break;
					case "uxIDUserCreatedDataGridViewColumn":
						e.Value = KnjizenjeList[e.RowIndex].IDUserCreated;
						break;
					case "uxIDUserModifiedDataGridViewColumn":
						e.Value = KnjizenjeList[e.RowIndex].IDUserModified;
						break;
					case "uxIDUserDataGridViewColumn":
						e.Value = KnjizenjeList[e.RowIndex].IDUser;
						break;
					case "uxDatumCreatedDataGridViewColumn":
						e.Value = KnjizenjeList[e.RowIndex].DatumCreated;
						break;
					case "uxDatumModifiedDataGridViewColumn":
						e.Value = KnjizenjeList[e.RowIndex].DatumModified;
						break;
					case "uxIDStatusDataGridViewColumn":
						e.Value = KnjizenjeList[e.RowIndex].IDStatus;
						break;
				default:
				break;
			}
		}
		
		/// <summary>
		/// Handles the CellValuePushed event of the uxKnjizenjeDataGridView control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="T:System.Windows.Forms.DataGridViewCellValueEventArgs"/> instance containing the event data.</param>
		protected void OnKnjizenjeDataGridViewCellValuePushed(object sender, System.Windows.Forms.DataGridViewCellValueEventArgs e)
		{
			switch(uxKnjizenjeDataGridView.Columns[e.ColumnIndex].Name)
			{
					case "uxIDDataGridViewColumn":
						KnjizenjeList[e.RowIndex].ID = (System.Int32)e.Value;
						break;
					case "uxDatumDataGridViewColumn":
						KnjizenjeList[e.RowIndex].Datum = (System.DateTime)e.Value;
						break;
					case "uxIDUserCreatedDataGridViewColumn":
						KnjizenjeList[e.RowIndex].IDUserCreated = (System.Int32)e.Value;
						break;
					case "uxIDUserModifiedDataGridViewColumn":
						KnjizenjeList[e.RowIndex].IDUserModified = (System.Int32)e.Value;
						break;
					case "uxIDUserDataGridViewColumn":
						KnjizenjeList[e.RowIndex].IDUser = (System.Int32)e.Value;
						break;
					case "uxDatumCreatedDataGridViewColumn":
						KnjizenjeList[e.RowIndex].DatumCreated = (System.DateTime)e.Value;
						break;
					case "uxDatumModifiedDataGridViewColumn":
						KnjizenjeList[e.RowIndex].DatumModified = (System.DateTime)e.Value;
						break;
					case "uxIDStatusDataGridViewColumn":
						KnjizenjeList[e.RowIndex].IDStatus = (System.Int32)e.Value;
						break;
				default:
				break;
			}
		}
	}
}
